#pragma once
#include "Lock.h"
#include "DBProtocol.h"
#include "MatchPlayer.h"
#include "MLProtocol.h"
#include "ObjPtrList.h"

class CProductList
{
public:
	CProductList(void);
	~CProductList(void);

	void AddProductInfo(MLAddProductMsg *pMsg, CMatchPlayer *pMatchPlayer);
	void UpdateProductInfo(MLUpdateProductMsg *pMsg);
	void DelProductInfo(MLDelProductMsg *pMsg);
	ProductInfo *FindProductInfo(DWORD dwProductId);
	void DeleteByMatchPlayer(CMatchPlayer *pMatchPlayer);
	void SynProductListMsg();
	void Lock();
	void Unlock();

	void LockSynMsg();
	void UnlockSynMsg();
public:
	DWORD m_dwGameId;
	CObjPtrList<ProductInfo> m_listProduct;
	CLock m_lockProductList;

	LCProductListMsg m_synProductListMsg;
	CLock m_lockSynMsg;
	DWORD m_tmLastSynTime;
};
